<?php
namespace Shopadmin\Controller;
use Think\Controller;
class ServiceController extends ExtendController {
	public function items(){

		$Q = I("get.q");
		$pg = I("get.pg");
		$items = I("get.numiids");
		if($items){
			Vendor('taobaosdk.top.request.ItemsListGetRequest');
			$req = new \ItemsListGetRequest;
			$req->setFields("num_iid,title,price,pic_url");
			$req->setNumIids($items);
			$resp = $this->c->execute($req, session("access_token"));
			$resp->total_results=count(explode(",",$items));
		}else{
			Vendor('taobaosdk.top.request.ItemsOnsaleGetRequest');
			$req = new \ItemsOnsaleGetRequest;
			// $req = new \ItemsInventoryGetRequest;
			$req->setFields("num_iid,title,price,pic_url");
			$req->setQ($Q);
			$req->setPageNo($pg);
			$req->setPageSize(20);
			$resp = $this->c->execute($req, session("access_token"));
			// $resp = $this->c->execute($req, "61023226da00f361e9545ba3f63b1a1319e80fb22d92ba42091447935");
		}
		$resp->q = $Q;
		$this->ajaxReturn($resp);
	}
}